#if !defined(_DAEMON_SUB_PROCESS)
#define _DAEMON_SUB_PROCESS
#include "unistd.h"

#define MAX_FAILED_COUNT 5
#define EXE_NAME "/usr/bin/gateway"
//#define EXE_NAME "/home/atguigu/workspace0722/gateway0722/test_gateway"

//子进程的结构体
typedef struct 
{
    pid_t pid; //子进程的pid
    char *sub_cmd; //子进程的命令
    int  failed_count; //子进程失败的次数
} SubProcess;


/**
 *  初始化子进程    
 */
SubProcess  *daemon_sub_process_init(char *sub_cmd);


/**
 *  检查并启动子进程
 */
int daemon_sub_process_check_and_start(SubProcess *sub_process);

/**
 * 结束子进程
 * 
 */
void daemon_sub_process_stop(SubProcess *sub_process);


#endif // _DAEMON_SUB_PROCESS
